package com.wagn.eduservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wagn.eduservice.entity.EduSubject;
import com.wagn.eduservice.entity.subject.SubjectClassifyEntity;
import com.wagn.eduservice.service.EduSubjectService;
import com.wagn.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-08-16
 */
@RestController
@RequestMapping("/eduservice/subject")
@CrossOrigin
public class EduSubjectController {

    @Autowired
    private EduSubjectService eduSubjectService;

    @PostMapping("addSubject")
    public R addSubject(MultipartFile file){

        eduSubjectService.saveSubject(file,eduSubjectService);
        return R.ok();
    }

    @GetMapping("getSubjectList")
    public R getSubjectList(){
        List<SubjectClassifyEntity> subjectList = eduSubjectService.getSubjectList(eduSubjectService);
        return R.ok().data("rows",subjectList);
    }


}

